Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle interMedia Java Classes API Reference 10g Release 2 (10.2) Part No. B14301-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ord.im
Class OrdAudio

`java.lang.Object
oracle.ord.im.OrdAudioBase
oracle.ord.im.OrdAudio`

All Implemented Interfaces:
  oracle.sql.CustomDatum, oracle.sql.CustomDatumFactory, oracle.jdbc.internal.ObjectData, oracle.jdbc.internal.ObjectDataFactory, oracle.sql.ORAData

public class OrdAudio
extends oracle.ord.im.OrdAudioBase

The OrdAudio class is used to represent an instance of the ORDSYS.ORDAudio database type in a Java application. The OrdAudio class includes a set of methods to get and set various object attributes, as well as a set of methods to perform various operations on an OrdAudio Java object.

Users of this class should be familiar with Oracle interMedia Reference.

Almost all methods operate on the attributes of the OrdAudio Java object in the application. The exceptions are those methods that access the audio data for read or write purposes, which are described in the following list:

- Methods that operate on the database BLOB specified by the localData attribute, read and write data stored in the database BLOB.
- Methods that operate on the database BFILE specified by the srcLocation and srcName attributes when the value of the srcType attribute is `file`, read data from the specified file.
- Methods that operate on the URL specified by the srcType, srcLocation, and srcName attributes when the value of the srcType attribute is `http`, read data from the resource at the specified URL.

If your application modifies the OrdAudio Java object, or the audio data in the database, you must update the ORDAudio SQL object in the database to make those changes permanent.

Some methods in the OrdAudio Java class are handed off to a database source plug-in or database format plug-in for processing; these methods have `byte [] ctx []` as a context parameter. Applications should allocate a 64-byte array to hold any context information that may be required by a source plug-in or a format plug-in. For example, a plug-in may initialize the context information in one call and use that information in a subsequent call. The source plug-in context requires one array; the format plug-in context requires another array. For most plug-ins, 64 bytes should be sufficient. Some user-defined plug-ins may need additional space. The following example shows how to allocate a plug-in context information array:

        byte [] ctx [] = new byte[1][64];

Note
In the current release, no Oracle-supplied source plug-ins or format plug-ins maintain context. Also, not all user-written source plug-ins or format plug-ins maintain context. However, if you include the context parameter as described, your application should work with any current or future source plug-ins or format plug-ins.

See Oracle interMedia Reference for more information about plug-ins.

Prerequisites

In order to run OrdAudio methods, you will need to include the following import statements in your Java file:

     import oracle.ord.im.OrdMediaUtil;
     import oracle.ord.im.OrdAudio;

You may also need to import classes from the following Java packages:

     java.io.
     java.sql.
     oracle.jdbc.

Before running OrdAudio methods, the following operations must have already been performed:

- A connection has been made to a table that contains a column of type OrdAudio.
- A local OrdAudio object has been created and populated with data.

For examples of making a connection and populating a local object, see Oracle interMedia User's Guide.

Field Summary

Fields inherited from class oracle.ord.im.OrdAudioBase
`_SQL_NAME, _SQL_TYPECODE`

Constructor Summary
`OrdAudio()` Deprecated.

Method Summary
`boolean` | `checkProperties(byte[][] ctx)` Checks if the properties of the audio data are consistent with the attributes of the OrdAudio Java object.
`void` | `clearLocal()` Clears the local attribute to indicate that the audio data is stored externally.
`int` | `closeSource(byte[][] ctx)` Closes a data source.
`oracle.sql.CustomDatum` | `create(oracle.sql.Datum d, int sqlType)` Exists as an internal method used only by the Oracle CustomDatum interface.
`void` | `deleteContent()` Deletes any data stored in the database BLOB specified by the localData attribute.
`void` | `export(byte[][] ctx, java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)` Exports the data from the BLOB specified by the localData attribute.
`oracle.sql.CLOB` | `getAllAttributes(byte[][] ctx)` Returns the values of the audio properties in a temporary CLOB in a form defined by the format plug-in.
`java.lang.String` | `getAttribute(byte[][] ctx, java.lang.String name)` Returns the value of the requested audio property.
`int` | `getAudioDuration()` Returns the value of the audioDuration attribute.
`oracle.sql.BFILE` | `getBFILE()` Returns a BFILE locator from the database when the value of the srcType attribute is `file`.
`oracle.sql.CLOB` | `getComments()` Returns the CLOB locator from the comments attribute.
`java.lang.String` | `getCompressionType()` Returns the value of the compressionType attribute.
`oracle.sql.BLOB` | `getContent()` Returns the BLOB locator from the localData attribute.
`oracle.sql.BLOB` | `getContentInLob(byte[][] ctx, java.lang.String[] mimetype, java.lang.String[] format)` Returns the data from the BLOB specified by the localData attribute in a temporary BLOB in the database.
`int` | `getContentLength()` Returns the length of the audio data.
`int` | `getContentLength(byte[][] ctx)` Returns the length of the audio data using source plug-in context information.
`byte[]` | `getDataInByteArray()` Returns a byte array containing the data from the database BLOB specified by the localData attribute.
`boolean` | `getDataInFile(java.lang.String filename)` Writes the data from the database BLOB specified by the localData attribute to a local file.
`java.io.InputStream` | `getDataInStream()` Returns an InputStream object from which the data in the database BLOB specified by the localData attribute can be read.
`java.lang.String` | `getDescription()` Returns the value of the description attribute.
`java.lang.String` | `getEncoding()` Returns the value of the encoding attribute.
`static oracle.sql.CustomDatumFactory` | `getFactory()` Deprecated. New applications should use the getORADataFactory method.
`java.lang.String` | `getFormat()` Returns the value of the format attribute.
`java.lang.String` | `getMimeType()` Returns the value of the mimeType attribute.
`int` | `getNumberOfChannels()` Returns the value of the numberOfChannels attribute.
`static oracle.sql.ORADataFactory` | `getORADataFactory()` Returns the OrdAudio ORADataFactory interface for use by the getORAData method.
`int` | `getSampleSize()` Returns the value of the sampleSize attribute.
`int` | `getSamplingRate()` Returns the value of the samplingRate attribute.
`java.lang.String` | `getSource()` Returns the source information in the form `srcType://srcLocation/srcName`.
`java.lang.String` | `getSourceLocation()` Returns the value of the srcLocation attribute.
`java.lang.String` | `getSourceName()` Returns the value of the srcName attribute.
`java.lang.String` | `getSourceType()` Returns the value of the srcType attribute.
`java.sql.Timestamp` | `getUpdateTime()` Returns the value of the updateTime attribute.
`void` | `importData(byte[][] ctx)` Imports data from an external source into the database BLOB specified by the localData attribute.
`void` | `importFrom(byte[][] ctx, java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)` Imports data from an external source into the database BLOB specified by the localData attribute.
`boolean` | `isLocal()` Indicates if the audio data is stored locally in the database in a BLOB specified by the localData attribute.
`boolean` | `loadDataFromByteArray(byte[] byteArr)` Loads data from a byte array into the database BLOB specified by the localData attribute.
`boolean` | `loadDataFromFile(java.lang.String filename)` Loads data from a file into the database BLOB specified by the localData attribute.
`boolean` | `loadDataFromInputStream(java.io.InputStream inpStream)` Loads data from an InputStream object into the database BLOB specified by the localData attribute.
`int` | `openSource(byte[] userarg, byte[][] ctx)` Opens a data source.
`byte[]` | `processAudioCommand(byte[][] ctx, java.lang.String cmd, java.lang.String args, byte[][] result)` Calls the format plug-in in the database to execute a command.
`byte[]` | `processSourceCommand(byte[][] ctx, java.lang.String cmd, java.lang.String args, byte[][] result)` Calls the source plug-in in the database to execute a command.
`int` | `readFromSource(byte[][] ctx, int startpos, int numbytes, byte[][] buffer)` Reads data from the data source.
`void` | `setAudioDuration(int audioDuration)` Sets the value of the audioDuration attribute.
`void` | `setComments(oracle.sql.CLOB comments)` Sets the value of the comments attribute.
`void` | `setCompressionType(java.lang.String compressionType)` Sets the value of the compressionType attribute.
`void` | `setDescription(java.lang.String description)` Sets the value of the description attribute.
`void` | `setEncoding(java.lang.String encoding)` Sets the value of the encoding attribute.
`void` | `setFormat(java.lang.String format)` Sets the value of the format attribute.
`void` | `setKnownAttributes(java.lang.String format, java.lang.String encoding, int numberOfChannels, int samplingRate, int sampleSize, java.lang.String compressionType, int audioDuration)` Sets the values of the known attributes of the OrdAudio Java object.
`void` | `setLocal()` Sets the value of the local attribute to indicate that the audio data is stored locally in the database in a BLOB specified by the localData attribute.
`void` | `setMimeType(java.lang.String mimeType)` Sets the value of the mimeType attribute.
`void` | `setNumberOfChannels(int numberOfChannels)` Sets the value of the numberOfChannels attribute.
`void` | `setProperties(byte[][] ctx)` Parses the audio data properties and sets the values of the attributes in the OrdAudio Java object.
`void` | `setProperties(byte[][] ctx, boolean setComments)` Parses the audio data properties, sets the values of the attributes in the OrdAudio Java object, and optionally populates the CLOB specified by the comments attribute.
`void` | `setSampleSize(int sampleSize)` Sets the value of the sampleSize attribute.
`void` | `setSamplingRate(int samplingRate)` Sets the value of the samplingRate attribute.
`void` | `setSource(java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)` Sets the values of the srcType, srcLocation, and srcName attributes.
`void` | `setUpdateTime(java.sql.Timestamp currentTime)` Sets the value of the updateTime attribute.
`int` | `trimSource(byte[][] ctx, int newLen)` Trims the data to the specified length.
`int` | `writeToSource(byte[][] ctx, int startpos, int numbytes, byte[] buffer)` Writes data to the data source.

Methods inherited from class oracle.ord.im.OrdAudioBase
`create, toDatum, toDatum`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OrdAudio

    public OrdAudio()

  Deprecated.
  Exists as an internal constructor used only by the Oracle ORAData interface factory method to create an instance of the class. Applications should not use this constructor.

Method Detail

### isLocal

    public boolean isLocal()
                    throws java.sql.SQLException

  Indicates if the audio data is stored locally in the database in a BLOB specified by the localData attribute.
  Returns:
    `true` if the data is stored locally in the database in a BLOB; `false` otherwise.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the local attribute.

### setLocal

    public void setLocal()
                  throws java.sql.SQLException

  Sets the value of the local attribute to indicate that the audio data is stored locally in the database in a BLOB specified by the localData attribute.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the local attribute.

### clearLocal

    public void clearLocal()
                    throws java.sql.SQLException

  Clears the local attribute to indicate that the audio data is stored externally.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the local attribute.

### getSourceType

    public java.lang.String getSourceType()
                                   throws java.sql.SQLException

  Returns the value of the srcType attribute.
  Returns:
    the value of the srcType attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the srcType attribute.

### getSourceLocation

    public java.lang.String getSourceLocation()
                                       throws java.sql.SQLException

  Returns the value of the srcLocation attribute.
  Returns:
    the value of the srcLocation attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the srcLocation attribute.

### getSourceName

    public java.lang.String getSourceName()
                                   throws java.sql.SQLException

  Returns the value of the srcName attribute.
  Returns:
    the value of the srcName attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the srcName attribute.

### getSource

    public java.lang.String getSource()
                               throws java.sql.SQLException

  Returns the source information in the form `srcType://srcLocation/srcName`.
  Returns:
    the source information, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding getSource method in the database.

### setSource

    public void setSource(java.lang.String srcType,
                          java.lang.String srcLocation,
                          java.lang.String srcName)
                   throws java.sql.SQLException

  Sets the values of the srcType, srcLocation, and srcName attributes.
  Parameters:
    `srcType` - the type of the source.
    `srcLocation` - the location of the source.
    `srcName` - the name of the source.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the srcType, srcLocation, or srcName attributes.

### getUpdateTime

    public java.sql.Timestamp getUpdateTime()
                                     throws java.sql.SQLException

  Returns the value of the updateTime attribute.
  Returns:
    the value of the updateTime attribute, as a `java.sql.Timestamp` object.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the updateTime attribute.

### setUpdateTime

    public void setUpdateTime(java.sql.Timestamp currentTime)
                       throws java.sql.SQLException

  Sets the value of the updateTime attribute. This method sets the value of the updateTime attribute to the specified time, or to the current SYSDATE time, if the value of the currentTime attribute is specified as `null`.
  Parameters:
    `currentTime` - the update time, or the `null` value, used to set the value of the updateTime attribute to the current SYSDATE time.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding setUpdateTime method in the database.

### getContent

    public oracle.sql.BLOB getContent()
                               throws java.sql.SQLException

  Returns the BLOB locator from the localData attribute.
  Returns:
    an `oracle.sql.BLOB` locator.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the localData attribute.

### getBFILE

    public oracle.sql.BFILE getBFILE()
                              throws java.sql.SQLException

  Returns a BFILE locator from the database when the value of the srcType attribute is `file`. This method calls the corresponding getBFILE method in the database, which creates the BFILE using the srcLocation and srcName attributes.
  Returns:
    an `oracle.sql.BFILE` locator.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding getBFILE method in the database.

### getContentLength

    public int getContentLength()
                         throws java.sql.SQLException

  Returns the length of the audio data. This method calls the corresponding getContentLength method in the database.

  This method is not supported for all source types. For example, the "http" source type does not support this method.

  Returns:
    the content length of the audio data, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding getContentLength method in the database.

### getContentLength

    public int getContentLength(byte[][] ctx)
                         throws java.sql.SQLException

  Returns the length of the audio data using source plug-in context information. This method calls the corresponding getContentLength method in the database.

  This method is not supported for all source types. For example, the "http" source type does not support this method.

  Parameters:
    `ctx` - the source plug-in context information.
  Returns:
    the value of the contentLength attribute, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding getContentLength method in the database.

### getDescription

    public java.lang.String getDescription()
                                    throws java.sql.SQLException

  Returns the value of the description attribute.
  Returns:
    the value of the description attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the description attribute.

### setDescription

    public void setDescription(java.lang.String description)
                        throws java.sql.SQLException

  Sets the value of the description attribute.
  Parameters:
    `description` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the description attribute.

### getFormat

    public java.lang.String getFormat()
                               throws java.sql.SQLException

  Returns the value of the format attribute.
  Returns:
    the value of the format attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the format attribute.

### setFormat

    public void setFormat(java.lang.String format)
                   throws java.sql.SQLException

  Sets the value of the format attribute.

  The format attribute determines which format plug-in is used to handle calls to methods that operate on the audio data. In particular, the setProperties method uses the format attribute to determine which format plug-in to call to parse the audio data properties. See the `setProperties(byte[][])` method for more information on how to initialize the format attribute before calling the setProperties method, and for information on how the setProperties method in the default, Oracle-supplied plug-in, sets the format attribute. Calling the setFormat method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `format` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the format attribute.

### getMimeType

    public java.lang.String getMimeType()
                                 throws java.sql.SQLException

  Returns the value of the mimeType attribute.
  Returns:
    the value of the mimeType attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the mimeType attribute.

### setMimeType

    public void setMimeType(java.lang.String mimeType)
                     throws java.sql.SQLException

  Sets the value of the mimeType attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `mimeType` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the mimeType attribute.

### getComments

    public oracle.sql.CLOB getComments()
                                throws java.sql.SQLException

  Returns the CLOB locator from the comments attribute.
  Returns:
    the value of the comments attribute, as an `oracle.sql.CLOB` locator.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the comments attribute.

### setComments

    public void setComments(oracle.sql.CLOB comments)
                     throws java.sql.SQLException

  Sets the value of the comments attribute.

  The comments attribute is reserved for use by interMedia. You can set your own value, but it could be overwritten by Oracle interMedia Annotator or by the `setProperties(byte[][])` method.

  Parameters:
    `comments` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the comments attribute.

### getEncoding

    public java.lang.String getEncoding()
                                 throws java.sql.SQLException

  Returns the value of the encoding attribute.
  Returns:
    the value of the encoding attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the encoding attribute.

### setEncoding

    public void setEncoding(java.lang.String encoding)
                     throws java.sql.SQLException

  Sets the value of the encoding attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `encoding` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the encoding attribute.

### getNumberOfChannels

    public int getNumberOfChannels()
                            throws java.sql.SQLException

  Returns the value of the numberOfChannels attribute.
  Returns:
    the value of the numberOfChannels attribute, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the numberOfChannels attribute.

### setNumberOfChannels

    public void setNumberOfChannels(int numberOfChannels)
                             throws java.sql.SQLException

  Sets the value of the numberOfChannels attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `numberOfChannels` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the numberOfChannels attribute.

### getSamplingRate

    public int getSamplingRate()
                        throws java.sql.SQLException

  Returns the value of the samplingRate attribute.
  Returns:
    the value of the samplingRate attribute, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the samplingRate attribute.

### setSamplingRate

    public void setSamplingRate(int samplingRate)
                         throws java.sql.SQLException

  Sets the value of the samplingRate attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `samplingRate` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the samplingRate attribute.

### getSampleSize

    public int getSampleSize()
                      throws java.sql.SQLException

  Returns the value of the sampleSize attribute.
  Returns:
    the value of the sampleSize attribute, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the sampleSize attribute.

### setSampleSize

    public void setSampleSize(int sampleSize)
                       throws java.sql.SQLException

  Sets the value of the sampleSize attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `sampleSize` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the sampleSize attribute.

### getCompressionType

    public java.lang.String getCompressionType()
                                        throws java.sql.SQLException

  Returns the value of the compressionType attribute.
  Returns:
    the value of the compressionType attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the compressionType attribute.

### setCompressionType

    public void setCompressionType(java.lang.String compressionType)
                            throws java.sql.SQLException

  Sets the value of the compressionType attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `compressionType` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the compressionType attribute.

### getAudioDuration

    public int getAudioDuration()
                         throws java.sql.SQLException

  Returns the value of the audioDuration attribute.
  Returns:
    the value of the audioDuration attribute, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the audioDuration attribute.

### setAudioDuration

    public void setAudioDuration(int audioDuration)
                          throws java.sql.SQLException

  Sets the value of the audioDuration attribute.

  The `setProperties(byte[][])` method sets the value of this attribute automatically for certain audio formats; use this method only if you are not using the setProperties method. This method sets only the attribute value; it does not modify the audio data itself.

  Parameters:
    `audioDuration` - the new attribute value.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing the audioDuration attribute.

### loadDataFromFile

    public boolean loadDataFromFile(java.lang.String filename)
                             throws java.sql.SQLException,
                                    java.io.IOException

  Loads data from a file into the database BLOB specified by the localData attribute. Before loading the data, this method calls the `deleteContent()` method to delete any existing data in the BLOB. It also calls the `setLocal()` method to set the local flag. In addition, this method calls the `setUpdateTime(java.sql.Timestamp)` method to set the value of the updateTime attribute to the current SYSDATE time.
  Returns:
    `true` if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns `false`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing an object attribute or executing a method in the database.
    `java.io.IOException` - if an error occurs reading the data file.

### loadDataFromInputStream

    public boolean loadDataFromInputStream(java.io.InputStream inpStream)
                                    throws java.sql.SQLException,
                                           java.io.IOException

  Loads data from an InputStream object into the database BLOB specified by the localData attribute. Before loading the data, this method calls the `deleteContent()` method to delete any existing data in the BLOB. It also calls the `setLocal()` method to set the local flag. In addition, this method calls the `setUpdateTime(java.sql.Timestamp)` method to set the value of the updateTime attribute to the current SYSDATE time.
  Parameters:
    `inpStream` - the name of the `InputStream` object from which the data will be loaded.
  Returns:
    `true` if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns `false`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing an object attribute or executing a method in the database.
    `java.io.IOException` - if an error occurs reading the InputStream object.

### loadDataFromByteArray

    public boolean loadDataFromByteArray(byte[] byteArr)
                                  throws java.sql.SQLException,
                                         java.io.IOException

  Loads data from a byte array into the database BLOB specified by the localData attribute. Before loading the data, this method calls the `deleteContent()` method to delete any existing data in the BLOB. It also calls the `setLocal()` method to set the local flag. In addition, this method calls the `setUpdateTime(java.sql.Timestamp)` method to set the value of the updateTime attribute to the current SYSDATE time.
  Parameters:
    `byteArr` - the name of the local `byte[]` array from which the data will be loaded.
  Returns:
    `true` if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns `false`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing an object attribute or executing a method in the database.
    `java.io.IOException` - if an error occurs reading the byte array.

### getDataInFile

    public boolean getDataInFile(java.lang.String filename)
                          throws java.sql.SQLException,
                                 java.io.IOException

  Writes the data from the database BLOB specified by the localData attribute to a local file.
  Parameters:
    `filename` - the name of the file to which the data will be written.
  Returns:
    `true` if the data is written to the file successfully; otherwise, an exception is raised if an error occurs. This method never returns `false`.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing an object attribute.
    `java.io.IOException` - if an error occurs reading the data from the BLOB or writing the data to the output file.

### getDataInStream

    public java.io.InputStream getDataInStream()
                                        throws java.sql.SQLException

  Returns an InputStream object from which the data in the database BLOB specified by the localData attribute can be read.
  Returns:
    an `InputStream` object from which the data will be read.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing an object attribute.

### getDataInByteArray

    public byte[] getDataInByteArray()
                              throws java.sql.SQLException,
                                     java.io.IOException,
                                     java.lang.OutOfMemoryError

  Returns a byte array containing the data from the database BLOB specified by the localData attribute.
  Returns:
    a `byte[]` array containing the data.
  Throws:
    `java.sql.SQLException` - if an error occurs accessing an object attribute.
    `java.io.IOException` - if an error occurs reading the data from the BLOB.
    `java.lang.OutOfMemoryError` - if sufficient memory cannot be allocated to hold the data.

### getContentInLob

    public oracle.sql.BLOB getContentInLob(byte[][] ctx,
                                           java.lang.String[] mimetype,
                                           java.lang.String[] format)
                                    throws java.sql.SQLException

  Returns the data from the BLOB specified by the localData attribute in a temporary BLOB in the database. This method creates a temporary BLOB in the database, reads the data from the BLOB specified by the localData attribute, writes the data to the temporary BLOB, and then returns the temporary BLOB locator to the caller.
  Note
  The application must free the temporary BLOB after accessing the data it contains.
  Parameters:
    `ctx` - the format plug-in context information.
    `mimetype` - a `String[]` array, 1 element in length, into which the mimeType attribute is written as element 0.
    `format` - a `String[]` array, 1 element in length, into which the format attribute is written as element 0.
  Returns:
    the audio data in a temporary `oracle.sql.BLOB` locator.
  Throws:
    `java.sql.SQLException` - if an error occurs creating the temporary BLOB or executing the corresponding getContentInLob method in the database.

### deleteContent

    public void deleteContent()
                       throws java.sql.SQLException

  Deletes any data stored in the database BLOB specified by the localData attribute.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding deleteContent method in the database.

### importData

    public void importData(byte[][] ctx)
                    throws java.sql.SQLException

  Imports data from an external source into the database BLOB specified by the localData attribute. The external data source is specified by the srcType, srcLocation, and srcName attributes.
  Parameters:
    `ctx` - the source plug-in context information.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding import method in the database.

### importFrom

    public void importFrom(byte[][] ctx,
                           java.lang.String srcType,
                           java.lang.String srcLocation,
                           java.lang.String srcName)
                    throws java.sql.SQLException

  Imports data from an external source into the database BLOB specified by the localData attribute. The external data source is specified by the srcType, srcLocation, and srcName parameters. The srcType, srcLocation, and srcName attributes are updated with values of the srcType, srcLocation, and srcName parameters passed to the importFrom method. See Oracle interMedia Reference for more information.
  Parameters:
    `ctx` - the source plug-in context information.
    `srcType` - the source type from which the data will be imported.
    `srcLocation` - the source location from which the data will be imported.
    `srcName` - the source name from which the data will be imported.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding importFrom method in the database.

### export

    public void export(byte[][] ctx,
                       java.lang.String srcType,
                       java.lang.String srcLocation,
                       java.lang.String srcName)
                throws java.sql.SQLException

  Exports the data from the BLOB specified by the localData attribute. This method calls the corresponding export method in the database to export the audio data to a location specified by the srcType, srcLocation, and srcName parameters.

  Not all source plug-ins support this method. Only the "file" source type is natively supported.

  This method will work only if you are running Oracle release 8.1.7 or later.

  The remainder of this description describes the use of the export method and the Oracle-supplied "file" source plug-in. User-written plug-ins will behave differently.

  The export method implemented by the "file" source plug-in copies, but does not modify, the audio data stored in the database BLOB specified by the localData attribute.

  After exporting the audio data, all the audio property attributes remain unchanged. However, the srcType, srcLocation, and srcName attributes are updated with values of the srcType, srcLocation, and srcName parameters passed to the export method. After calling the export method, if you no longer intend to manage the audio data within the database, call the `clearLocal()` method to indicate that the audio data is stored outside the database, and call the `deleteContent()` method to delete the audio data stored in the database BLOB.

  See Oracle interMedia Reference for information about the privileges required to write to a database directory object. See Oracle Database Java Developer's Guide and the java.io.FilePermission class in the Java API for information about security and performance.

  Parameters:
    `ctx` - the source plug-in context information.
    `srcType` - the source type to which the content will be exported.
    `srcLocation` - the source location to which the content will be exported.
    `srcName` - the source name to which the content will be exported.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding export method in the database.

### setProperties

    public void setProperties(byte[][] ctx)
                       throws java.sql.SQLException

  Parses the audio data properties and sets the values of the attributes in the OrdAudio Java object. This method sets the values of the format, mimeType, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, and audioDuration attributes. An attribute value is set to `null` if the corresponding property cannot be extracted for a specific audio format. This method throws a SQLException error if the audio format is not recognized.

  The format attribute determines which format plug-in is used to parse the audio data properties. If the value of the format attribute is `null` when the setProperties method is called, then the default, Oracle-supplied, format plug-in is used to parse the audio data properties and fill in various attributes, including the actual audio data format, for supported audio formats. See Oracle interMedia Reference for information on the audio formats supported by the Oracle-supplied format plug-ins. Note that the ORDAudio.init methods in the database always set the value of the format attribute to `null`. If the value of the format attribute is not `null`, then the format plug-in specified by the format attribute will be called when the setProperties method is called.

  Parameters:
    `ctx` - the format plug-in context information.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding setProperties method in the database.

### setProperties

    public void setProperties(byte[][] ctx,
                              boolean setComments)
                       throws java.sql.SQLException

  Parses the audio data properties, sets the values of the attributes in the OrdAudio Java object, and optionally populates the CLOB specified by the comments attribute. This method sets the values of the format, mimeType, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, and audioDuration attributes. An attribute value is set to `null` if the corresponding property cannot be extracted for a specific audio format. If the setComments parameter is true, this method also populates the CLOB specified by the comments attribute with all extracted properties in XML form. If the setComments parameter is false, the comments attribute is not modified. This method throws a SQLException error if the audio format is not recognized.

  The format attribute determines which format plug-in is used to parse the audio data properties. If the value of the format attribute is `null` when the setProperties method is called, then the default, Oracle-supplied, format plug-in is used to parse the audio data properties and fill in various attributes, including the actual audio data format, for supported audio formats. See Oracle interMedia Reference for information on the audio formats supported by the Oracle-supplied format plug-ins. Note that the ORDAudio.init methods in the database always set the value of the format attribute to `null`. If the value of the format attribute is not `null`, then the format plug-in specified by the format attribute will be called when the setProperties method is called.

  Parameters:
    `ctx` - the format plug-in context information.
    `setComments` - a `boolean` value that specifies whether or not to populate the CLOB specified by the comments attribute.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding setProperties method in the database.

### checkProperties

    public boolean checkProperties(byte[][] ctx)
                            throws java.sql.SQLException

  Checks if the properties of the audio data are consistent with the attributes of the OrdAudio Java object.
  Parameters:
    `ctx` - the format plug-in context information.
  Returns:
    `true` if the properties of the audio data are consistent with the attributes of the OrdAudio Java object; `false` otherwise.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding checkProperties method in the database.

### getAttribute

    public java.lang.String getAttribute(byte[][] ctx,
                                         java.lang.String name)
                                  throws java.sql.SQLException

  Returns the value of the requested audio property. This method is used by user-defined format plug-ins to return the value of an audio property that is not available as an attribute of the OrdAudio Java object. This method is not implemented by any Oracle-supplied format plug-ins.
  Parameters:
    `ctx` - the format plug-in context information.
    `name` - the property or attribute name.
  Returns:
    the value of the attribute, as a `String`.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding getAttribute method in the database.

### getAllAttributes

    public oracle.sql.CLOB getAllAttributes(byte[][] ctx)
                                     throws java.sql.SQLException

  Returns the values of the audio properties in a temporary CLOB in a form defined by the format plug-in. For natively supported formats, the information is presented as a comma-separated list of attributes. The list of attributes is of the form `attributeName=attributeValue`, where the list contains the following attributes: format, mimeType, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, and audioDuration. For user-defined formats, the information is presented in a form defined by the format plug-in.
  Note
  The application must free the temporary CLOB after reading the information it contains.
  Parameters:
    `ctx` - the format plug-in context information.
  Returns:
    the values of the attributes as a temporary CLOB, `oracle.sql.CLOB`.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding getAllAttributes method in the database.

### setKnownAttributes

    public void setKnownAttributes(java.lang.String format,
                                   java.lang.String encoding,
                                   int numberOfChannels,
                                   int samplingRate,
                                   int sampleSize,
                                   java.lang.String compressionType,
                                   int audioDuration)
                            throws java.sql.SQLException

  Sets the values of the known attributes of the OrdAudio Java object.

  The `setProperties(byte[][])` method sets the values of the following attributes automatically for certain audio formats: format, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, and audioDuration. Use this method only if you are not using the setProperties method. This method sets only the specified attribute values; it does not modify the audio data itself.

  Parameters:
    `format` - the new attribute value, as a `String`.
    `encoding` - the new attribute value, as a `String`.
    `numberOfChannels` - the new attribute value, as an integer (`int`).
    `samplingRate` - the new attribute value, as an integer (`int`).
    `sampleSize` - the new attribute value, as an integer (`int`).
    `compressionType` - the new attribute value, as a `String`.
    `audioDuration` - the new attribute value, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding setKnownAttributes method in the database.

### processAudioCommand

    public byte[] processAudioCommand(byte[][] ctx,
                                      java.lang.String cmd,
                                      java.lang.String args,
                                      byte[][] result)
                               throws java.sql.SQLException

  Calls the format plug-in in the database to execute a command. This method is used with user-written format plug-ins only; it raises an exception if used with the format plug-ins supplied by Oracle.
  Parameters:
    `ctx` - the format plug-in context information.
    `cmd` - the command to be executed by the format plug-in.
    `args` - the arguments of the command.
    `result` - a `byte[][]` array of the form [1][`n`] into which the result of the command execution is written.
  Returns:
    the results of the executing the command.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding processAudioCommand method in the database.

### openSource

    public int openSource(byte[] userarg,
                          byte[][] ctx)
                   throws java.sql.SQLException

  Opens a data source.
  Parameters:
    `userarg` - additional source plug-in information that may be required by user-defined source plug-ins.
    `ctx` - the source plug-in context information.
  Returns:
    the status as an integer (`int`), where zero indicates success and a nonzero value indicates a failure code specific to the source plug-in.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding openSource method in the database.

### closeSource

    public int closeSource(byte[][] ctx)
                    throws java.sql.SQLException

  Closes a data source.
  Parameters:
    `ctx` - the source plug-in context information.
  Returns:
    the status as an integer (`int`), where zero indicates success and a nonzero value indicates a failure code specific to the source plug-in.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding closeSource method in the database.

### readFromSource

    public int readFromSource(byte[][] ctx,
                              int startpos,
                              int numbytes,
                              byte[][] buffer)
                       throws java.sql.SQLException

  Reads data from the data source. This method reads the specified number of bytes into the application buffer from the data source, starting at the specified position in the data source.

  Not all source plug-ins require that the data source be opened before it can be read. However, to ensure that an application will work with any current or future source plug-ins, call the `openSource(byte[], byte[][])` method before calling this method.

  Parameters:
    `ctx` - the source plug-in context information.
    `startpos` - the start position in the data source.
    `numbytes` - the number of bytes to be read from the data source.
    `buffer` - a `byte[][]` array of the form [1][`n`], where `n` is greater than or equal to `numbytes`.
  Returns:
    the number of bytes read, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding readFromSource method in the database.

### writeToSource

    public int writeToSource(byte[][] ctx,
                             int startpos,
                             int numbytes,
                             byte[] buffer)
                      throws java.sql.SQLException

  Writes data to the data source. This method writes the specified number of bytes from the application buffer to the data source, starting at the specified position in the data source.

  Not all source plug-ins support write operations. For example, applications can write to a BLOB specified by the localData attribute; however, the "file" and "http" data source types do not support write access, and so do not support this method. Furthermore, those source plug-ins that do support write access may support only sequential write access, and may not support write access to arbitrary starting positions within the data source.

  Not all source plug-ins require that the data source be opened before it can be written. However, to ensure that an application will work with any current or future source plug-ins, call the `openSource(byte[], byte[][])` method before calling this method.

  Parameters:
    `ctx` - the source plug-in context information.
    `startpos` - the start position in the data source.
    `numbytes` - the number of bytes to be written to the data source.
    `buffer` - a `byte[]` array containing the data to be written.
  Returns:
    the number of bytes written, as an integer (`int`).
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding writeToSource method in the database.

### trimSource

    public int trimSource(byte[][] ctx,
                          int newLen)
                   throws java.sql.SQLException

  Trims the data to the specified length.

  Not all source plug-ins support trim operations. For example, applications can trim the data stored in a BLOB specified by the localData attribute; however, the "file" and "http" data source types do not support write access, and so do not support this method. Furthermore, those source plug-ins that do support write access may not support the trim operation.

  Not all source plug-ins require that the data source be opened before it can be modified. However, to ensure that an application will work with any current or future source plug-ins, call the `openSource(byte[], byte[][])` method before calling this method.

  Parameters:
    `ctx` - the source plug-in context information.
    `newLen` - the length to which the data is to be trimmed.
  Returns:
    the status as an integer (`int`), where zero indicates success and a nonzero value indicates a failure code specific to the source plug-in.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding trimSource method in the database.

### processSourceCommand

    public byte[] processSourceCommand(byte[][] ctx,
                                       java.lang.String cmd,
                                       java.lang.String args,
                                       byte[][] result)
                                throws java.sql.SQLException

  Calls the source plug-in in the database to execute a command. This method is used with user-written plug-ins only; it raises an exception if used with the source plug-ins supplied by Oracle.
  Parameters:
    `ctx` - the source plug-in context information.
    `cmd` - the command to be executed by the source plug-in.
    `args` - the arguments of the command.
    `result` - a `byte[][]` array of the form [1][`n`] into which the result of the command execution is written.
  Returns:
    the results of executing the command.
  Throws:
    `java.sql.SQLException` - if an error occurs executing the corresponding processSourceCommand method in the database.

### getORADataFactory

    public static oracle.sql.ORADataFactory getORADataFactory()

  Returns the OrdAudio ORADataFactory interface for use by the getORAData method. Specify the getORADataFactory method as the factory parameter of the getORAData method when retrieving an OrdAudio object from an OracleResultSet or OracleCallableStatement object.
  Returns:
    the OrdAudio implementation of the ORADataFactory interface.

### getFactory

    public static oracle.sql.CustomDatumFactory getFactory()

  Deprecated. New applications should use the getORADataFactory method.

### create

    public oracle.sql.CustomDatum create(oracle.sql.Datum d,
                                         int sqlType)
                                  throws java.sql.SQLException

  Exists as an internal method used only by the Oracle CustomDatum interface. Applications should not call this method.
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle interMedia Java Classes API Reference 10g Release 2 (10.2) Part No. B14301-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999, 2005, Oracle. All rights reserved.